﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;

namespace Aribaccio.Copyright
{
    /// <summary>
    /// 注册版权参数信息项类
    /// </summary>
    [ComVisible(true)]
    [ClassInterface(ClassInterfaceType.None)]
    public class RegisterCopyPara : IRegisterCopyPara
    {
        /// <summary>
        /// 默认日期期限天数
        /// </summary>
        public int Days { get; set; }
        /// <summary>
        /// 日期期限（结束/终止日期）
        /// </summary>
        public DateTime TimeLimit { get; set; }
        /// <summary>
        /// 序列号
        /// </summary>
        public string SerialNum { get; set; }
        /// <summary>
        /// 注册项键值-注册默认序列号的拼接符
        /// </summary>
        public string Concatenator { get { return "-"; } }
        /// <summary>
        /// 版权信息项拼接字符串
        /// </summary>
        public string SerialLimit { get { return this.SerialNum + this.Concatenator + this.TimeLimit.ToShortDateString(); } }

        /// <summary>
        /// 构造函数
        /// </summary>
        public RegisterCopyPara()
        {
            this.Days = 30;
            this.SerialNum = "SECRET-CRYPTO";
            this.TimeLimit = Convert.ToDateTime(DateTime.Now.AddDays(this.Days).ToShortDateString());
        }

        /// <summary>
        /// 构造函数
        /// </summary>
        public RegisterCopyPara(int argDefaultDays)
        {
            this.Days = argDefaultDays;
            this.SerialNum = "SECRET-CRYPTO";
            this.TimeLimit = Convert.ToDateTime(DateTime.Now.AddDays(this.Days).ToShortDateString());
        }
    }
}
